package cn.iocoder.yudao.module.trade.order.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/02/06
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AppTradeOrderSettlementPriceRespVO {

    @Schema(description = "原价，不包含运费，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "500")
    private Integer totalPrice;

    @Schema(description = "会员价，不包含运费，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "500")
    private Integer totalVipPrice;

    @Schema(description = "所需积分抵扣数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
    private Integer totalPointDeductCount;

    @Schema(description = "所需联盟豆抵扣数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
    private Integer totalCryptocurrencyDeductCount;

    @Schema(description = "折扣减免金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "66")
    private Integer discountPrice;

    @Schema(description = "优惠劵减免金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
    private Integer couponPrice;

    @Schema(description = "团购套餐减免金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
    private Integer grouponPrice;

    @Schema(description = "积分抵扣的金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
    private Integer pointPrice;

    @Schema(description = "联盟豆抵扣的金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
    private Integer cryptocurrencyPrice;

    @Schema(description = "会员价减免金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "30")
    private Integer vipPrice;

    @Schema(description = "批发价减免金额，单位：分", example = "30")
    private Integer wholesalePrice;

    @Schema(description = "用户等级优惠减免金额，单位：分", example = "30")
    private Integer memberLevelPrice;

    @Schema(description = "运费金额，单位：分", example = "50")
    private Integer deliveryPrice;

    @Schema(description = "实际支付金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "450")
    private Integer payPrice;

    @Schema(description = "实际优惠金额，单位：分", example = "30")
    private Integer promotionPrice;

    @SuppressWarnings("unused")
    public Integer getPromotionPrice() {
        if (promotionPrice != null) {
            return promotionPrice;
        }
        return getTotalPrice() + getDeliveryPrice() - getPayPrice();
    }

    @Schema(description = "用餐人数", example = "0")
    private Integer dinePeoples;

}
